package com.yiqi.liebang.feature.home.model;

import com.luck.picture.lib.rxbus2.RxBus;
import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.CouponBo;
import com.yiqi.liebang.entity.bo.PageBo;
import com.yiqi.liebang.entity.bo.SearchBo;
import com.yiqi.liebang.entity.bo.TopicBo;
import com.yiqi.liebang.entity.bo.TopicListBo;
import com.yiqi.liebang.feature.home.contract.TopicContract;
import com.yiqi.liebang.feature.home.dependencies.topic.DaggerTopicModelComponent;
import com.yiqi.liebang.feature.mine.contract.CouponContract;
import com.yiqi.liebang.feature.mine.dependencies.coupon.DaggerCouponModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.HomeApi;
import com.yiqi.liebang.framework.api.UserApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class TopicModel implements TopicContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public TopicModel() {
        DaggerTopicModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<TopicBo>> getTopicList(TopicListBo workBo) {
        return api.getTopList(workBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<TopicBo>> searchTopic(SearchBo searchBo) {
        return api.searchTopic(searchBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }


}
